<?php
/**
* Django's templating engine (partial) PHP implementation.
* provides some template tags support
* @link http://djangoproject.com
* this file is from a webappkit package (kit)
* @link http://webappkit.net
* @package djtpl
* @author J.Ducastel <nospam0@ducastel.name>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/

/**
* 'cycle' tag node
*/
class djtplTagNode_cycle extends djtplTagNode {

    /**
    * builds itself from tokens
    * @param djangoTplToken &$selfToken
    * @param array &$nextTokens djangoTplToken
    * @access public
    * @return bool
    */
    function buildFromTokens(&$selfToken) {
        $def=$selfToken->tagdef;
        $this->values=explode(',',$def);
        return true;
    }/**/

    /**
    * is the node atomic (has no children)
    * @access public
    * @return bool
    */
    function isAtomic() {
        return true;
    }/**/

    /**
    * renders node to string
    * @param
    * @access public
    * @return string
    */
    function render(&$context) {
        $rendered=current($this->values);
        if (!next($this->values))
            reset($this->values);
        return $rendered;
    }/**/
/*------------------------------------------------------------------------------
                                                                      properties
------------------------------------------------------------------------------*/
    /**
    * @var array values to cycle through
    */
    var $values=array();
    var $tagname='cycle';
} /* end of djtpltagnode_cycle class */